package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author OZ.L.XO
 * #Description OrderDetailMapper
 * #Date: 2025/7/11 19:45
 */
@Mapper
public interface OrderDetailMapper {
    /**
     * 批量插入订单明细数据
     */
    void insertBatch(List<OrderDetail> orderDetailList);

    /**
    * @Description 查询订单明细
    * @Param [userId]
    * @Date 2025/8/1 0:17
    **/
    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> listByOrderId(Long orderId);

    /**
    * @Description 统计指定时间区间内的销量排名top10
    * @Param [begin, end]
    * @Date 2025/8/1 0:17
    **/
    List<GoodsSalesDTO> getByTime(LocalDateTime begin, LocalDateTime end, Integer status);
}
